package jq.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jq.action.UpdateCurrencyAction;
import jq.dao.IEntityManagerImpl;
import jq.entity.Currency;

public class UpdateCurrency extends HttpServlet{
	private static final long serialVersionUID = 2979606700480694814L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		 List<Currency> c=new UpdateCurrencyAction().updateCurrency();
		 IEntityManagerImpl.getInstance().saveEntityList(c);
		 req.getSession().setAttribute("currency", c);
		 req.getSession().setAttribute("result", "update currency success");
		 resp.sendRedirect("currency.jsp");
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req,resp);
	}
	
}
